package com.itheima.string;

import jdk.management.resource.internal.inst.FileOutputStreamRMHooks;

import java.util.Scanner;

public class Test02 {
    public static void main(String[] args) {
        //创建键入变量
        Scanner sc = new Scanner(System.in);
        //用户提示
        System.out.println("请输入");

        //创建字符串变量接收键入变量
        String s = sc.next();

        //使用toCharArray()方法将输入的字符串转为字符数组
        char[] chars = s.toCharArray();

        for (int i = 0; i < chars.length; i++) {
            System.out.println(chars[i]);
        }

    /*    //charAt方法遍历数组,length()方法取得字符串的长度
        for(int i = 0;i < s.length();i++ ){
            char c = s.charAt(i);
            System.out.println(c);
        }*/
    }








}
